﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Caching;
using System.Diagnostics;
using System.Data;
using System.Data.Common;
using Microsoft.DataWarehouse.Design;

namespace DistributedCacheDataProvider
{
    public class DistributedCacheSchema : IDbSchema
    {
        #region IDbSchema Members

        public DbConnection DbConnection
        {
            get
            {
                throw new NotImplementedException();
            }
            set
            {
                throw new NotImplementedException();
            }
        }

        public void Dispose()
        {
            throw new NotImplementedException();
        }

        public DataTable GetSchema()
        {
            throw new NotImplementedException();
        }

        public DataTable GetSchema(string collectionName)
        {
            Debug.WriteLine("DistributedCacheSchema.GetSchema(string collectionName)", "DistributedCacheConnection");
            CacheFactory cacheCluster = new CacheFactory();
            Cache cache = cacheCluster.GetCache("TestCache");

            DataTable schema = new DataTable();
            DataRow row;

            schema.Columns.Add("Test Column");
            row = schema.NewRow();
            row[0] = "Test Column Value";
            schema.Rows.Add(row);
            return schema;
        }

        public DataTable GetSchema(string collectionName, string[] restrictionValues)
        {
            Debug.WriteLine("DistributedCacheSchema.GetSchema(string collectionName, string[] restrictionValues)", "DistributedCacheConnection");
            Debug.WriteLine("DistributedCacheSchema.GetSchema(string collectionName)", "DistributedCacheConnection");
            CacheFactory cacheCluster = new CacheFactory();
            Cache cache = cacheCluster.GetCache("TestCache");

            DataTable schema = new DataTable();
            DataRow row;

            schema.Columns.Add("Test Column");
            row = schema.NewRow();
            row[0] = "Test Column Value";
            schema.Rows.Add(row);
            return schema;
            
        }

        #endregion
    }
}
